<template>
	<view class="apps">
		<viwe class="flex  ptb20 plr20 bgg fdc">
			<view class="flex aic" v-if="islogin">
				<view class="">
					<uv-avatar :src="userInfo.avatar"></uv-avatar>
				</view>
				<view class="f1 f16">{{userInfo.username}}</view>
			</view>
		</viwe>
		
	</view>
</template>

<script>
	let app;
	export default {
		data() {
			return {
				userInfo:{},
				islogin:false,
			}
		},
		onLoad(){
			app = this;
			if(uni.getStorageSync('xxx_token')){
				app.islogin = true;
				app.userInfo = uni.getStorageSync('xxx_userinfo').userinfo;
				//app.getUserInfo();
			}else{
				uni.navigateTo({
					url:"pages/login/login"
				})
			}
			
		},
		methods: {
			getUserInfo(){
				app.request({
					url:"/mpwechat/userinfo",
					type:"POST",
					success:function(rlt){
						if(rlt.code == 1){
							app.userInfo = rlt.data;
						}
					}
				})
			}
		}
	}
</script>

<style>

</style>
